package com.xthink.common.utils;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;


import java.util.Date;

@Slf4j
public class TranSidUtils {

     public static  String getTranSid(){
          String APPID ="C5010100070967100100000";

          DateTime date = DateUtil.date();
          String dateString = DateUtil.format(date, "yyyyMMddHHmmss");

          Snowflake snowflake = IdUtil.getSnowflake(1, 1);
          long l = snowflake.nextId();
          String s = Long.toString(l);
          String substring = s.substring(s.length() - 8);

          log.info("TranSid:"+APPID+dateString+substring);

          return  APPID + dateString + substring;

     }
}
